/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.jjsoft.celularessuc.gco.mdl;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Johnny
 */
@Entity
@Table(name = "proveedor_articulo", catalog = "celularessuccom", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ProveedorArticulo.findAll", query = "SELECT p FROM ProveedorArticulo p"),
    @NamedQuery(name = "ProveedorArticulo.findByIdproveedorarticulo", query = "SELECT p FROM ProveedorArticulo p WHERE p.idproveedorarticulo = :idproveedorarticulo")})
public class ProveedorArticulo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer idproveedorarticulo;
    @JoinColumn(name = "codigoArticulo", referencedColumnName = "codigo")
    @ManyToOne
    private Articulo codigoArticulo;
    @JoinColumn(name = "idProveedor", referencedColumnName = "idProveedor")
    @ManyToOne
    private Proveedor idProveedor;

    public ProveedorArticulo() {
    }

    public ProveedorArticulo(Integer idproveedorarticulo) {
        this.idproveedorarticulo = idproveedorarticulo;
    }

    public Integer getIdproveedorarticulo() {
        return idproveedorarticulo;
    }

    public void setIdproveedorarticulo(Integer idproveedorarticulo) {
        this.idproveedorarticulo = idproveedorarticulo;
    }

    public Articulo getCodigoArticulo() {
        return codigoArticulo;
    }

    public void setCodigoArticulo(Articulo codigoArticulo) {
        this.codigoArticulo = codigoArticulo;
    }

    public Proveedor getIdProveedor() {
        return idProveedor;
    }

    public void setIdProveedor(Proveedor idProveedor) {
        this.idProveedor = idProveedor;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idproveedorarticulo != null ? idproveedorarticulo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProveedorArticulo)) {
            return false;
        }
        ProveedorArticulo other = (ProveedorArticulo) object;
        if ((this.idproveedorarticulo == null && other.idproveedorarticulo != null) || (this.idproveedorarticulo != null && !this.idproveedorarticulo.equals(other.idproveedorarticulo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jjsoft.celularessuc.gco.mdl.ProveedorArticulo[ idproveedorarticulo=" + idproveedorarticulo + " ]";
    }
    
}
